home *** CD-ROM | disk | FTP | other *** search
- import java.applet.Applet;
- import java.awt.Button;
- import java.awt.Color;
- import java.awt.Component;
- import java.awt.Container;
- import java.awt.Event;
- import java.awt.Graphics;
-
- public class Scribble1 extends Applet {
- private int lastx;
- private int lasty;
- Button clear_button;
- // $FF: renamed from: g java.awt.Graphics
- Graphics field_0;
-
- public void init() {
- this.clear_button = new Button("Clear");
- ((Container)this).add(this.clear_button);
- this.field_0 = ((Component)this).getGraphics();
- }
-
- public boolean mouseDown(Event var1, int var2, int var3) {
- this.lastx = var2;
- this.lasty = var3;
- return true;
- }
-
- public boolean mouseDrag(Event var1, int var2, int var3) {
- this.field_0.setColor(Color.black);
- this.field_0.drawLine(this.lastx, this.lasty, var2, var3);
- this.lastx = var2;
- this.lasty = var3;
- return true;
- }
-
- public boolean keyDown(Event var1, int var2) {
- if (var1.id == 401 && var2 == 1073) {
- this.clear();
- return true;
- } else {
- return false;
- }
- }
-
- public boolean action(Event var1, Object var2) {
- if (var1.target == this.clear_button) {
- this.clear();
- return true;
- } else {
- return false;
- }
- }
-
- public void clear() {
- this.field_0.setColor(((Component)this).getBackground());
- this.field_0.fillRect(0, 0, ((Component)this).bounds().width, ((Component)this).bounds().height);
- }
- }
-